package com.lcx.plugin.neteaseCloud.music.entity;

/**
 * @author daxiong
 * @date 2021/10/28 下午2:25
 */
public class LyricEntity {
    /**
     * 取秒的后一位
     * eg:[03:06.639] => (3*60 + 6) * 10 + 6
     */
    private Integer timeInt;
    private String lyric;

    public LyricEntity(String timeStr, String lyric) {
        this.timeInt = str2Int(timeStr);
        this.lyric = lyric;
    }

    public Integer getTimeInt() {
        return timeInt;
    }

    public void setTimeInt(Integer timeInt) {
        this.timeInt = timeInt;
    }

    public String getLyric() {
        return lyric;
    }

    public void setLyric(String lyric) {
        this.lyric = lyric;
    }

    private Integer str2Int(String timeStr) {
        // eg:[03:06.639 => (3*60 + 6) * 10 + 6
        timeStr = timeStr.substring(1, 9);
        String[] split = timeStr.split(":");
        int minute = Integer.parseInt(split[0]);
        String[] strs = split[1].split("\\.");
        int second = Integer.parseInt(strs[0]);
        int last = Integer.parseInt(strs[1]) / 100;
        return (minute * 60 + second) * 10 + last;
    }

    public String[] converter() {
        String[] arr = new String[1];
        arr[0] = lyric;
        return arr;
    }

}
